package com.ytjj.qmyx.mall.mapper;

import com.ytjj.qmyx.mall.model.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface OrdersMapper {
    long countByExample(OrdersExample example);

    int deleteByExample(OrdersExample example);

    int deleteByPrimaryKey(Integer id);

    Integer updateStatus(Integer ordersInfo);

    Integer updateOrderStatus(Integer id, Integer status);

    /**
     * 取消订单
     * @param isPay 是否付款
     * @return Integer
     */
    Integer cancelOrderByParams(@Param("record") Orders record,@Param("isPay") Integer isPay);

    int insert(Orders record);

    int insertSelective(Orders record);

    List<Orders> selectByExample(OrdersExample example);

    Orders selectByPrimaryKey(Integer id);

    Orders selectById(Integer id);

    int updateByExampleSelective(@Param("record") Orders record, @Param("example") OrdersExample example);

    int updateByExample(@Param("record") Orders record, @Param("example") OrdersExample example);

    int updateByPrimaryKeySelective(Orders record);

    int updateByPrimaryKey(Orders record);

    Integer selectByorderNo(@Param("orderNo") String orderNo);

    Orders selectByOrderNo(@Param("orderNo") String orderNo);

    int deleteByOrderNo(String orderNo);

    int countByDynamicIdsByDay(@Param("dynamicIds") List<Integer> dynamicIds);

    int countByDynamicIdsByWeek(@Param("dynamicIds") List<Integer> dynamicIds);

    int selectOrdersZhuanShu(Integer userId);

    Integer findProducTypeByOrderId(Integer orderId);

//    OrderNote findRemarkById(Integer id,String childOrderNo);

    boolean insertOrderRemark(OrderNote orderNote);

    boolean updateOrderRemark(OrderNote orderNote);

    boolean updateBankerOrderAddress(BankerOrder bankerOrder);

    List<OrdersInfo> selectByIds(@Param("list") List<Integer> orderInfoIdList);

    Integer sumOrderVolumeByActivityType(String activityType);

    List<Orders> queryPayOrderByVivoList(@Param("channel") String channel,
                                         @Param("interval") Integer interval,
                                         @Param("orderSource") String orderSource);

    /**
     * 最近的num笔订单
     * @param num 最近预支付笔数
     * @param minute 最近多少分钟前的订单
     * @param mark 支付平台 1：支付宝 2-微信
     * @return List<OrdersPay>
     */
    List<OrdersPay> getRecentOrders(Integer num,Integer minute,Integer mark,String domainUrl);

    int checkIsPayOrderCount(int minute);

    Integer queryNoPayAndNoCancelCount(@Param("h5Token") String h5Token);

    List<Orders> checkOrdersAddress(@Param("minute")int minute);

    List<Orders> queryErrorOrderRemarkOrder();

    Integer updateErrorOrderRemark(@Param("orderIds") List<Integer> orderIds);

    /**
     * 查询当天用户支付成功数量
     * @param phone
     * @param day
     * @return
     */
    Integer queryUserPaySuccessOrderNum(@Param("phone")String phone,@Param("day")Integer day);


}
